﻿using Adp;
using Microsoft.AspNetCore.Mvc;
using Yqd.Models;
using System.Linq;
using Yqd.Controllers.Filter;

namespace Yqd.Controllers
{
    [Area("Yqd")]
    public class WxUnitController : Controller
    {
        YqdContext ctx;

        public WxUnitController(YqdContext ctx)
        {
            this.ctx = ctx;
        }

       [User]
        public ActionResult GetList()
        {
            var r = ctx.Database.SqlQuery<Yqd_Unit>("select * from Yqd_Unit where UnitCode!= '330782000000' order by Tactic asc");
            return this.ToJson(new
            {
                success = true,
                data = r.Select(it => new
                {
                    name = it.Name,
                    value = it.UnitCode
                })
            });
        }
    }
}
